package alex.example.pruebas2;

import java.io.IOException;
import java.util.ArrayList;

import org.xmlpull.v1.XmlPullParserException;

import android.R.string;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.content.*;
import android.content.res.XmlResourceParser;


public class dataLoader extends Activity{
	private ArrayList<String> todoItems;
	
	public dataLoader(){
		todoItems = new ArrayList<String>();
	}
	

	public ArrayList<String> PrepareListFromXml() {
		  	XmlResourceParser todolistXml = getResources().getXml(R.xml.init);

			int eventType = -1;
			while (eventType != XmlResourceParser.END_DOCUMENT) {
				if (eventType == XmlResourceParser.START_TAG) {

					String strNode = todolistXml.getName();
					if (strNode.equals("piedra")) {
						String s=todolistXml.getAttributeValue(null,"nombre");
						String s1=todolistXml.getAttributeValue(null,"ref_bloque");
						todoItems.add(s);
						todoItems.add(s1);
					}
				}

				try {
					eventType = todolistXml.next();
				} catch (XmlPullParserException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return todoItems;
	}
}	


